import clientSize from '@/assets/PublicStaticValue/ClientSize/clientSize'
const state = {
  width: 0
}
const getters = {
  getWidth: (state: any): number => {
    return state.width
  },
  getWidthState: (state: any): number => {
    let State = clientSize.screen_xs
    if (state.width > clientSize.screen_xl) {
      State = clientSize.screen_xl
    } else if (state.width > clientSize.screen_lg) {
      State = clientSize.screen_lg
    } else if (state.width > clientSize.screen_md) {
      State = clientSize.screen_md
    } else if (state.width > clientSize.screen_sm) {
      State = clientSize.screen_sm
    } else {
      State = clientSize.screen_xs
    }
    return State
  }
}
const mutations = {
  SetWidth: (state: any, width: number) => {
    state.width = width
  }
}
const actions = {
  setWidth: ({ commit }: any, width: number) => {
    commit('SetWidth', width)
  }
}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
